package com.chinackts.auth.controller;

import com.chinackts.auth.dto.AuthInitDto;
import com.chinackts.auth.dto.LoginParamsDto;
import com.chinackts.auth.service.AuthService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author Lianhong
 * @since 2021/10/25
 */
@RestController
public class AuthController implements AuthControllerInterface {

    @Resource
    private AuthService authService;

    @Override
    public ResponseEntity<AuthInitDto> init() {
        return ResponseEntity.ok(authService.init());
    }

    @Override
    public ResponseEntity<Void> login(String id, LoginParamsDto loginParamsDto) {
        authService.login(id, loginParamsDto);
        return ResponseEntity.noContent().build();
    }
}
